#ifndef ROLLER_COASTER_MODEL_H_
#define ROLLER_COASTER_MODEL_H_

#include "model.h"
#include "path.h"
#include "column.h"
#include "top_model.h"

class RollerCoasterModel : public Model{
	private:
		Model& hModel;
		Model& tModel;

		// Camino de la curva
		Path railPath;

		// Riel
		std::vector<Point> railPoints;
		// Columnas
		std::vector<Column> columns;

		static const float railWidth;
		static const float railHeight;
		static const unsigned int columnStep;
		static const float columnWidth;
		static const float columnDepth;

		// Superficie del riel
		std::vector<Point> vecSurfacePoints;
		std::vector<Point> vecNormalSurface;
		std::vector<unsigned int> vecIndex;
		std::vector<unsigned int> vecPointCountBySegment;

	public:
		RollerCoasterModel(Model& hmodel,Model& tmodel);
		~RollerCoasterModel();

		void calculate();
		void calculateRailPoints();
		void calculateColumns();

		unsigned int pointSize(){
			return this->railPath.size();
		}

		Path& getRailPath(){
			return this->railPath;
		}

		std::vector<Point>& getSurfacePoints(){
			return this->vecSurfacePoints;
		}

		std::vector<Point> getNormalSurface(){
			return this->vecNormalSurface;
		}

		const std::vector<unsigned int>& getIndex(){
			return this->vecIndex ;
		}

		unsigned int getCurvePointCountBySegment();

		unsigned int getIndexSize(unsigned int segment);

		std::vector<unsigned int> getPointCountBySegment(){
			return this->vecPointCountBySegment ;
		}

		std::vector<Column>::const_iterator columnBegin(){
			return columns.begin();
		}

		std::vector<Column>::const_iterator columnEnd(){
			return columns.end();
		}

		std::vector<Point>& getRailPoints(){
			return railPoints;
		}

		std::vector<Column>& getColumns(){
			return columns;
		}

		std::vector<Point>::const_iterator pointBegin(){
			return railPath.begin();
		}

		std::vector<Point>::const_iterator pointEnd(){
			return railPath.end();
		}

		TopModel& getTopModel();

		void getIndices();

		void calculateSurfacePoints();

		void getPointCountByPlane();

		unsigned int getPlaneCount();
};

#endif /* ROLLER_COASTER_MODEL_H_ */
